package algorythms;

import individuals.Individual;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Elite{

	public List<Individual> applyAlgorythm(List<Individual> population, int n) {
		
		List<Individual> ansList = new ArrayList<Individual>();
		
		Collections.sort(population);
		
		if(n> population.size())
			return population;
		
		for(int i =0; i < n; i++){
			ansList.add(population.get(i));
		}
		
		return ansList;
	}

}
